/**
 * Copyright (C), 2020, 安徽贝慕信息科技有限公司
 * FileName: ServiceResourceController
 * Author:   Allen
 * Date:     2020/8/1 18:45
 * Description: 服务资源处理Controller
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.bim.marvel.rest;

import com.bim.marvel.openapi.client.dto.ServiceResourceDTO;
import com.bim.marvel.openapi.client.query.ServiceResourceQuery;
import com.bim.marvel.common.core.model.dto.SimpleVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.validation.Valid;
import java.util.List;

/**
 * 〈服务资源处理Controller〉
 *
 * @author Allen
 * @date 2020/8/1
 * @since 1.0.0
 */
@Api(tags = {"服务资源处理-controller"})
@RequestMapping("/api/service/resource")
public interface ServiceResourceController {

    /**
     * 保存服务资源请求URL
     */
    String SERVICE_RESOURCE_SAVE_URL = "/save";

    /**
     * 更新服务资源请求URL
     */
    String SERVICE_RESOURCE_UPDATE_URL = "/update";

    /**
     * 获得服务资源列表URL
     */
    String GET_SERVICE_RESOURCE_LIST_URL = "/list";

    /**
     * 保存服务资源信息
     * @param serviceResourceQuery 服务资源信息入参
     * @return 保存结果
     */
    @ApiOperation(value = "保存服务资源信息", notes = "保存服务资源信息",
            protocols = "http,https", httpMethod = "POST")
    @PostMapping(value = SERVICE_RESOURCE_SAVE_URL, consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE},
            produces = {MediaType.APPLICATION_JSON_VALUE})
    SimpleVO<Boolean> saveServiceResource(@Valid ServiceResourceQuery serviceResourceQuery);

    /**
     * 更新服务资源信息
     * @param serviceResourceQuery 服务资源入参
     * @return 更新结果
     */
    @ApiOperation(value = "更新服务资源信息", notes = "更新服务资源信息",
            protocols = "http,https", httpMethod = "POST")
    @PostMapping(value = SERVICE_RESOURCE_UPDATE_URL, consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE},
            produces = {MediaType.APPLICATION_JSON_VALUE})
    SimpleVO<Boolean> updateServiceResource(@Valid ServiceResourceQuery serviceResourceQuery);

    /**
     * 得到服务资源列表(由于服务资源不会过多，故而无须分页)
     * @return 服务资源列表
     */
    @ApiOperation(value = "得到服务资源列表", notes = "得到服务资源列表",
            protocols = "http,https", httpMethod = "GET")
    @GetMapping(value = GET_SERVICE_RESOURCE_LIST_URL, produces = {MediaType.APPLICATION_JSON_VALUE})
    SimpleVO<List<ServiceResourceDTO>> getServiceResourceList();

}
